<template>
	<view class="content">
		<view class="box">
			<view class="up">
				<view class="left">
					订单编号: {{info.orderSn}}
				</view>
			</view>
			<view class="center">
				<view class="center-c">
					<view class="ibox">
						<image :src="info.productPic" mode=""></image>
					</view>
					<view class="text">
						<view class="c-top">
							<view class="title">
								{{info.productName}}
							</view>
							<view class="price">
								￥{{info.productPrice}}
							</view>
						</view>
						<view class="c-c">
							<view class="top">
								<view class="left">
									编号: {{info.id}}
								</view>
								<view class="right">
									数量: X{{info.productCount}}
								</view>
							</view>
							<view class="guige">
								<view>
									规格:
								</view>
								<view class="norms">
									<view class="n-box" v-for="(item1,index) in info.productAttr" :key="index">
										{{item1.key}}:
										{{item1.value}}
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>

			</view>
			<view class="bottom">
				<view class="b-top">
					<view class="time">
						时间: {{info.createTime}}
					</view>
					<view class="total">
						合计: ￥{{info.returnAmount}}
					</view>
				</view>
			</view>
		</view>
		<view class="list">
			<view class="inp">
				<view class="text">
					退单数量:
				</view>
				<view>
					<input  type="text" disabled="true" :value="info.productCount"  />
				</view>
			</view>
			<view class="inp">
				<view class="text">
					退货原因:
				</view>
				<view>
					<input  type="text" disabled="true" :value="info.reason"  />
				</view>
			</view>
			<view class="inp">
				<view class="text">
					退货公司:
				</view>
				<view>
					<input  type="text" disabled="true" :value="address.addressName"  />
				</view>
			</view>
			<view class="inp">
				<view class="text">
					问题描述:
				</view>
				<view>
					<input  type="text" disabled="true" :value="info.description"  />
				</view>
			</view>
			<view class="upload">
				<view class="text">
					<view class="top">
						温馨提醒:
					</view>
					<view class="down">
						上传图片总大小不能超过3m，单个文件大小不能超过1m，图片总个数不能超过3张
					</view>
				</view>
				<view class="imgbox">
					<view class="upimg">
						<view v-for="(item,index) in imgList" :key="index" class="seleimg">
							<image :src="item" mode=""></image>
						</view>
					</view>
					
				</view>
				
			</view>
		</view>
		<view class="list">
			<view class="inp">
				<view class="text">
					订单状态:
				</view>
				<view>
					
					{{ info.status | statusText }}
				</view>
			</view>
			<view class="inp">
				<view class="text">
					处理人:
				</view>
				<view>
					<input  type="text" disabled="true" :value="info.handleMan"  />
				</view>
			</view>
			<view class="inp">
				<view class="text">
					处理时间:
				</view>
				<view>
					<input  type="text" disabled="true" :value="info.createTime"  />
				</view>
			</view>
			<view class="inp">
				<view class="text">
					处理意见:
				</view>
				<view>
					<input  type="text" disabled="true" :value="info.handleNote"  />
				</view>
			</view>
			<view class="inp">
				<view class="text">
					接收人:
				</view>
				<view>
					<input  type="text" disabled="true" :value="info.receiveMan"  />
				</view>
			</view>
			<view class="inp">
				<view class="text">
					接受时间:
				</view>
				<view>
					<input  type="text" disabled="true" :value="info.receiveTime"  />
				</view>
			</view>
			<view class="inp">
				<view class="text">
					备注:
				</view>
				<view>
					<input  type="text" disabled="true" :value="info.receiveNote"  />
				</view>
			</view>
			<view class="inp"> 
				<view class="text">
					客服电话:
				</view>
				<view>
					<input  type="text" disabled="true" value="(0371) 5560 2883"  />
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		orderReturn,
		getCompanyAddrss
	} from "@/api/mine/mine.js"
	export default {
		filters:{
			statusText(val) {
				if (val == 0) {
					return "待处理"
				} else if (val == 1) {
					return "退货中"
				} else if (val == 2) {
					return "已完成"
				} else if (val == 3) {
					return "已拒绝"
				} else {
					return "暂定"
				}
			}
			
		},
		
		data() {
			return {
				info: '',
				address:'',
				imgList:[]
			}
		},
		onLoad(a) {
			orderReturn(a.id).then(res => {
				// console.log(res)
				this.info = res.data.orderReturnApply
				this.info.productAttr = JSON.parse(this.info.productAttr)
				this.imgList  = this.info.proofPics.split(',')
				console.log(this.imgList)
			})
			this.getaddress(a.id1)
		},
		methods: {
			getaddress(val){
				getCompanyAddrss().then(res=>{
					
					this.address = res.data.items.find(el=>{
						return el.id == val
					})
					
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		padding: 30rpx;
	}

	.box {
		background-color: #fff;
		border-radius: 16rpx;
		padding: 40rpx;

		.ibox {
			width: 160rpx;
			height: 160rpx;
		}

		image {
			width: 160rpx;
			height: 160rpx;
		}

		.up {
			width: 100%;
			height: 60rpx;
			// line-height: 60rpx;
			font-size: 24rpx;
			display: flex;
			justify-content: space-between;
			border-bottom: 2rpx solid #f1ece7;
		}

		.center {
			margin: 30rpx 0;
			border-bottom: 2rpx solid #f1ece7;

			.center-c {
				display: flex;
				justify-content: space-between;

				align-items: center;
				.text {
					font-size: 26rpx;
					color: #3e3e3e;
					padding: 30rpx;
					line-height: 50rpx;

					.c-top {
						display: flex;

					}

					.c-c {
						color: #8d8d8d;
					}

					.guige {
						.norms {
							display: flex;

							.n-box {
								margin-right: 30rpx;
							}
						}
					}


				}
			}
		}
		.bottom {
				padding-top: 20rpx;
		
				.b-top {
					display: flex;
					justify-content: space-between;
					font-size: 26rpx;
				}
		
			}
	}

	.list{
		margin: 30rpx auto;
		
		background-color: #fff;
		.inp{
			
			padding: 25rpx 25rpx;
			display: flex;
			justify-content: space-between;
			font-size: 24rpx;
			border-bottom: 2rpx solid #f1ece7;
			input{
				font-size: 24rpx;
				text-align: right;
			}
			
		}
		.upload{
			padding: 25rpx 25rpx;
			font-size: 24rpx;
			.top{
				font-weight: 600;
			}
			.upimg{
				margin-top: 20rpx;
				text-align: center;
				display: flex;
				
				.seleimg{
					margin-right: 20rpx;
					image{
						width: 100rpx;
						height: 100rpx;
					}
					
				}
				
				
			}
		}
	}
</style>
